package com.wuzheng.wisgo.sanitation.cloud.controller.facility;

import com.wuzheng.wisgo.sanitation.cloud.model.facility.param.TrashStateParam;
import com.wuzheng.wisgo.sanitation.cloud.model.facility.pojo.TrashStateDTO;
import com.wuzheng.wisgo.sanitation.cloud.service.facility.FacilityService;
import com.wuzheng.wisgo.sanitation.framework.base.controller.BaseController;
import com.wuzheng.wisgo.sanitation.framework.core.constant.SysRespEnum;
import com.wuzheng.wisgo.sanitation.framework.core.protocol.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author：hoipang
 * @date：Created in 2019-12-17
 * @description：
 * @modified By：
 * @version: 1.0
 */
@RestController
@RequestMapping("/trash")
@Api(value = "TrashCtrl", tags = "垃圾桶接口")
public class TrashCtrl extends BaseController {
    @Resource
    FacilityService facilityService;

    /**
     * 根据条件查询地图上所有垃圾桶状态
     */
    @PostMapping(value = "/states")
    @ApiOperation(value = "根据条件查询地图上所有垃圾桶状态")
    public Result<List<TrashStateDTO>> list(@RequestBody TrashStateParam trashStateParam) {
        return this.success(SysRespEnum.SUCCESS.getMessage(), facilityService.listTrashStateDTOs(trashStateParam));
    }
}
